<?php
/**
 * Created by JetBrains PhpStorm.
 * User: JKen22078
 * Date: 7/22/13
 * Time: 10:52 PM
 * To change this template use File | Settings | File Templates.
 */
class Support extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
        $this->load->helper(array('form', 'url'));
        $this->load->library('form_validation');
        $this->load->library('pagination');
        $this->load->model('support_file');
        $this->load->library('javascript');
        $this->load->library('javascript/jquery');
    } //load library
    public function index(){}
    public function view($viewsp = 'getsp'){
        //die($viewsp);
        switch ($viewsp) {
            case 'getsp':
                //die('r');
                $data['getsp'] = $this->getsupport();
                $data['view'] = 'getsp';

                break;
            case 'insert':
                 //die('2');
                //$exetension = $this->input->post('extension', true);
                //$data = array('type' => $exetension);
                //$this->support_file->setSupport();
                $data['insertOK'] = 'ok';
                $data['view'] = 'insert';
                break;
            default:
                break;
        }
        $this->load->view('pages/task/support', $data);
    }
    public function setsupport()
    {
        if($_POST){
            $exetension = $this->input->post('extension', true);
            $data = array('type' => $exetension);
            $this->support_file->setSupport($data);
        }else{
            echo 'ko thanh cong';
            echo '<a href="'.site_url('upload').'"></a>';

        }
    }

    //them duoi file ho tro
    function getsupport()
    {
        //die('s');
        $data = $this->support_file->support_file_type();
        return $data;
    }

    function del_support($id)
    {
        //$id = $this->input->post('id',true);
        $data = array('id' => $id);
        $deleteOK = $this->support_file->deleteSupport($data);
    }


}